package p2;

// Murat Muratovic
// CS 4500 03/23/2012
// P1



public class P2Nodes<T> implements Comparable<P2Nodes<T>> {

	protected T data;
	protected boolean visited;
	public Integer index = null;
	public Integer lowlink = null;
	public double distance = Double.POSITIVE_INFINITY;
	public P2Nodes<T> predecessor = null;

	public P2Nodes(T data) {
		this.data = data;
	}

	public P2Nodes() {

	}

	public boolean isVisited() {
		return visited;
	}

	public void visit() {
		visited = true;
	}

	public void unvisit() {
		visited = false;
	}

	public int compareTo(P2Nodes<T> ob) {
		String tempA = this.toString();
		String tempB = ob.toString();

		return tempA.compareTo(tempB);
	}

	public String toString() {
		return data.toString();
	}

}
class Vertex implements Comparable<Vertex> {
	public final String name;
	public TempEdge[] adjacencies;
	public double minDistance = Double.POSITIVE_INFINITY;
	public Vertex previous;

	public Vertex(String argName) {
		name = argName;
	}

	public String toString() {
		return name;
	}

	public int compareTo(Vertex other) {
		return Double.compare(minDistance, other.minDistance);
	}
}


class Edge {

	protected P2Nodes a, b;
	protected double weight;

	public Edge(P2Nodes a, P2Nodes b) {
		this(a, b, Double.POSITIVE_INFINITY);
	}

	public Edge(P2Nodes a2, P2Nodes b2, double weight) {
		this.a = a2;
		this.b = b2;
		this.weight = weight;
	}

	public double getWeight() {
		return weight;
	}

	public String toString() {
		return a + " ==> " + b;
	}
}

class TempEdge {
	public final Vertex target;
	public final double weight;

	public TempEdge(Vertex argTarget, double argWeight) {
		target = argTarget;
		weight = argWeight;
	}
}
